import { createRouter, createWebHistory } from 'vue-router'
import { Menu as IconMenu, Message, Setting } from "@element-plus/icons-vue";

export const children = [
  {
    path: '/main/index',
    name: 'index',
    meta: { title: '首页', img: ['../../public/img/png/首页.png', '../../public/img/png/首页 2.png'] },
    component: () => import('../views/main/IndexView.vue')
  },
  {
    path: '/main/train',
    name: 'train',
    meta: { title: '车次管理', img: ['../../public/img/png/车次管理.png', '../../public/img/png/车次管理 2.png'] },
    component: () => import('../views/main/TrainView.vue')
  },
  {
    path: '/main/station',
    name: 'station',
    meta: { title: '车站管理', img: ['../../public/img/png/车站管理.png', '../../public/img/png/车站管理 2.png'] },
    component: () => import('../views/main/StationView.vue')
  },
  {
    path: '/main/line',
    name: 'line',
    meta: { title: '线路管理', img: ['../../public/img/png/线路管理.png', '../../public/img/png/线路管理 2.png'] },
    component: () => import('../views/main/LineView.vue')
  },
  {
    path: '/main/ticket',
    name: 'ticket',
    meta: { title: '车票管理', img: ['../../public/img/png/车票管理.png', '../../public/img/png/车票管理 2.png'] },
    component: () => import('../views/main/TicketView.vue')
  },
  {
    path: '/main/order',
    name: 'order',
    meta: { title: '订单管理', img: ['../../public/img/png/订单管理.png', '../../public/img/png/订单管理 2.png'] },
    component: () => import('../views/main/OrderView.vue')
  },
  {
    path: '/main/map',
    name: 'map',
    meta: { title: '个人轨迹监控', img: ['../../public/img/png/轨迹管理.png', '../../public/img/png/轨迹管理 2.png'] },
    component: () => import('../views/main/MapView.vue')
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "/main/index"
    },
    {
      path: '/main',
      name: 'main',
      component: () => import(/* webpackChunkName: main */ '../views/MainView.vue'),
      children: children
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    }
  ]
})

export default router
